<?php
namespace Home\Controller;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

use Home\Lib\Foo;

class IndexController extends \Gy_Library\GyController{
    public function index(){
        $vehicle = D('VehicleNumber')->getParentOptions("id","number");
        $shop = D('CarShop')->getParentOptions("id","name");
        $this->assign('vehicle', $vehicle);
        $this->assign('shop', $shop);
        $this->display();
    }
    public function add(){
        if (IS_POST) {
            $data = I('post.');
            $model = D('PersonInfo');
            $r = $model->createAdd($data);
            if($r === false){
                $this->error($model->getError());
            }
            else{
                $this->success('成功提交抽奖信息，请等待抽奖结果');
            }
        }
    }
}
